package cn.zlp.hrm.controller;

import cn.zlp.hrm.service.IImageVerifyCodeService;
import cn.zlp.hrm.util.AjaxResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

/**
 * @program: hrm-parent
 * @author: Mr.Zhang
 * @create: 2022-01-13 09:19
 **/
@RestController
@RequestMapping("/imageVerifyCode")
public class ImageVerifyCodeController {

    @Autowired
    private IImageVerifyCodeService imageVerifyCodeService;

    /**
     * 发送图片验证码
     * @param imageCodeKey
     * @return
     */
    @GetMapping("/{imageCodeKey}")
    public AjaxResult getCodeByKey(@PathVariable("imageCodeKey") String imageCodeKey){
        return imageVerifyCodeService.getCodeByKey(imageCodeKey);
    }

    /**
     * 图片验证码校验
     * @param params
     * @return
     */
    @PostMapping("/verify")
    public AjaxResult smsVerifyCode(@RequestBody Map<String,String> params){
        return imageVerifyCodeService.smsVerifyCode(params);
    }

}
